package com.funny.learning.english.model;

import org.json.JSONObject;

import android.util.Log;

public class GameEntity {

	private String TAG = "GameEntity";

	private int idKey;
	private int iid;
	private String definition;
	private String name;
//	private String searchEN;
//	private String searchVI;
	private String url;
	private String id;
	private String lname;
	private String laudio;
	private String lphonetics;
	private String lcontext;
	private String lreminiscence;
	private String ldefinition;
	private String slugTopic;
	private String slugSubTopic;
	private String slugGameType;
	private int date;
	private JSONObject mJsonObject;

	public GameEntity() {
	}

	public GameEntity(JSONObject jsonObject, String slugTopic,
			String slugSubTopic, String slugGameType) {
		this.slugGameType = slugGameType;
		this.slugSubTopic = slugSubTopic;
		this.slugTopic = slugTopic;
		mJsonObject = jsonObject;
		if (jsonObject != null) {
			definition = jsonObject.optString("definition", "");
			iid = jsonObject.optInt("iid", 0);
			name = jsonObject.optString("name", "");

//			JSONObject jObjSearch = jsonObject.optJSONObject("search");
//			Log.d(TAG, "jObjSearch::" + jObjSearch.toString());
//			if (jObjSearch != null) {
//				searchEN = jObjSearch.optString("en", "");
//				searchVI = jObjSearch.optString("vi", "");
//			}
//
			url = jsonObject.optString("url", "");
			id = jsonObject.optString("id", "");

			JSONObject jObjVocal = jsonObject.optJSONObject("vocab");
			if (jObjVocal != null) {
				Log.d(TAG, "jObjVocal::" + jObjVocal.toString());

				lname = jObjVocal.optString("lname", "");
				laudio = jObjVocal.optString("laudio", "");
				lphonetics = jObjVocal.optString("lphonetics", "");
				lcontext = jObjVocal.optString("lcontext", "");
				lreminiscence = jObjVocal.optString("lreminiscence", "");
				ldefinition = jObjVocal.optString("ldefinition", "");
			}
		}
	}

	public JSONObject toJson() {
		if (mJsonObject != null)
			return mJsonObject;
		return null;
	}

	public int getIid() {
		return iid;
	}

	public void setIid(int iid) {
		this.iid = iid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

//	public String getSearchEN() {
//		return searchEN;
//	}
//
//	public void setSearchEN(String searchEN) {
//		this.searchEN = searchEN;
//	}
//
//	public String getSearchVI() {
//		return searchVI;
//	}
//
//	public void setSearchVI(String searchVI) {
//		this.searchVI = searchVI;
//	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getLname() {
		return lname;
	}

	public void setLname(String lname) {
		this.lname = lname;
	}

	public String getLaudio() {
		return laudio;
	}

	public void setLaudio(String laudio) {
		this.laudio = laudio;
	}

	public String getNphonetics() {
		return lphonetics;
	}

	public void setNphonetics(String nphonetics) {
		this.lphonetics = nphonetics;
	}

	public String getLcontext() {
		return lcontext;
	}

	public void setLcontext(String lcontext) {
		this.lcontext = lcontext;
	}

	public String getLreminiscence() {
		return lreminiscence;
	}

	public void setLreminiscence(String lreminiscence) {
		this.lreminiscence = lreminiscence;
	}

	public String getLdefinition() {
		return ldefinition;
	}

	public void setLdefinition(String ldefinition) {
		this.ldefinition = ldefinition;
	}

	public String getDefinition() {
		return definition;
	}

	public void setDefinition(String definition) {
		this.definition = definition;
	}

	public String getLphonetics() {
		return lphonetics;
	}

	public void setLphonetics(String lphonetics) {
		this.lphonetics = lphonetics;
	}

	public String getSlugTopic() {
		return slugTopic;
	}

	public void setSlugTopic(String slugTopic) {
		this.slugTopic = slugTopic;
	}

	public String getSlugSubTopic() {
		return slugSubTopic;
	}

	public void setSlugSubTopic(String slugSubTopic) {
		this.slugSubTopic = slugSubTopic;
	}

	public String getSlugGameType() {
		return slugGameType;
	}

	public void setSlugGameType(String slugGameType) {
		this.slugGameType = slugGameType;
	}

	public int getIdKey() {
		return idKey;
	}

	public void setIdKey(int idKey) {
		this.idKey = idKey;
	}

	public int getDate() {
		return date;
	}

	public void setDate(int date) {
		this.date = date;
	}

	@Override
	public String toString() {
		return "GameEntity [TAG=" + TAG + ", idKey=" + idKey + ", iid=" + iid
				+ ", definition=" + definition + ", name=" + name
				+ ", url=" + url + ", id=" + id + ", lname=" + lname
				+ ", laudio=" + laudio + ", lphonetics=" + lphonetics
				+ ", lcontext=" + lcontext + ", lreminiscence=" + lreminiscence
				+ ", ldefinition=" + ldefinition + ", slugTopic=" + slugTopic
				+ ", slugSubTopic=" + slugSubTopic + ", slugGameType="
				+ slugGameType + ", date=" + date + "]";
	}

}
